package diary.core.service;

import java.util.Date;
import java.util.UUID;

import diary.core.entity.Diary;

public class DiaryService {

	public Diary get(String name, String content) {

		Diary diary = new Diary();
		diary.setId(UUID.randomUUID().toString());
		diary.setName(name);
		diary.setCreateTime(new Date());
		diary.setContent(content);

		return diary;
	}

	public static void main(String[] args) {
		int length = args.length;
		String name = "未知名称";
		String content = "未知内容";
		if (length == 1) {
			if (!args[0].trim().equals("")) {
				name = args[0].trim();
			}
		} else if (length >= 2) {
			if (!args[0].trim().equals("")) {
				name = args[0].trim();
			}
			if (!args[1].trim().equals("")) {
				content = args[1].trim();
			}
		}
		DiaryService diaryService = new DiaryService();
		Diary diary = diaryService.get(name, content);
		System.out.println("日记详细信息:" + diary.toString());
	}

}